package com.lzw.service.impl.student;

import com.lzw.mapper.student.StudentMapper;
import com.lzw.service.student.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public boolean login(String username, String password) {
        return studentMapper.checkCredentials(username, password) != null;
    }

    @Override
    public Map<String, Object> getStudentInfo(String username, String password) {
        return studentMapper.getStudentInfo(username,password);
    }

    @Override
    public Map<String, Object> getStudentInfoById(Integer studentId) {
        return studentMapper.getStudentInfoById(studentId);
    }

    @Override
    public boolean updateStudentInfo(Integer studentId, String name, String gender, String phone, String email) {
        return studentMapper.updateAdminInfo(studentId, name, gender, phone, email) > 0;
    }
}
